import 'package:earclean/app/routes/app_pages.dart';
import 'package:earclean/app/util/Yue_utils.dart';
import 'package:get/get.dart';

class ServeinfoController extends GetxController {
  final bannerList = [].obs;
  List serviceTechnicians = [];
  final projectTimer = ''.obs;
  final projectName = ''.obs;
  final projectPrice = "".obs;
  final serviceProcess = "".obs;
  final userGroup = "".obs;
  final taboos = "".obs;
  final warmReminder = "".obs;

  @override
  void onInit() {
    Map info = Get.arguments ?? {};
    bannerList.value = info['projectImgs'] ?? [];
    serviceTechnicians = info['serviceTechnicians'] ?? [];
    projectTimer.value = info['projectTimer'] ?? '';
    projectName.value = info['projectName'] ?? '';
    projectPrice.value = (info['projectPrice'] ?? "0").toString();
    if (info.isNotEmpty) {
      Map classMap = info['class'] ?? {};
      serviceProcess.value = classMap['serviceProcess'] ?? "";
      userGroup.value = classMap['userGroup'] ?? "";
      taboos.value = classMap['taboos'] ?? "";
      warmReminder.value = classMap['warmReminder'] ?? "";
    }
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
  }

  toJishi() {
    Get.toNamed(Routes.JISHI, arguments: {
      'list': serviceTechnicians,
      'projectTimer': projectTimer.value,
      'projectName': projectName.value,
      'projectPrice':int.parse(projectPrice.value)
    });
  }

  @override
  void onClose() {}
}
